import Vue from 'vue'
import App from './App.vue'
import router from './router'
import './plugins/element.js'
import './assets/css/global.css'
import axios from 'axios'
import TreeTable from 'vue-table-with-tree-grid'

// 配置请求的根路径
axios.defaults.baseURL = 'http://timemeetyou.com:8889/api/private/v1/'
// 挂载之前做token拦截
axios.interceptors.request.use(config => {
  // 配置请求头的授权字段
  config.headers.Authorization = window.sessionStorage.getItem('token')
  return config
})

// 全局注册表格组件
Vue.component('tree-table', TreeTable)

// 全局挂载axios，使用this.$http
Vue.prototype.$http = axios
Vue.config.productionTip = false

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
